package 笔试题;

/**
 * @author 帅小伙
 * @date 2022/1/8
 * @description
 */
public class Demo2024检测所有A在B之前 {

    public boolean checkString(String s) {
        char[] chars = s.toCharArray();

        int b = 0;

        for (int i = 0; i < chars.length; i++) {
            if(chars[i] == 'a' && b!=0){
                return false;
            }
            if(chars[i]=='b'){
                b++;
            }
        }
        return true;
    }
}
